package cn.openea.perpartner.wxpay.controller;

import cn.openea.perpartner.wxpay.service.AuthService;
import cn.openea.perpartner.wxpay.vo.PayVo;
import cn.openea.perpartner.wxpay.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;
/**
 * @Name: 微信支付接口鉴权
 * @author: Mr.Yun
 * @Created: 2022/10/15 21:15
 */
@Api(tags = "微信支付接口鉴权")
@RestController
@RequestMapping("/api")
public class AuthController {

    @Autowired
    AuthService authService;

    @Autowired
    RedisTemplate<String, Object> redisTemplate;

    @ApiOperation("获取调用微信支付接口的token授权")
    @RequestMapping(value = "/getoken", method = RequestMethod.POST)
    public R getToken(@RequestBody  @ApiParam(name="需要授权的参数JSON串",
            value = "将所有请求参数以JSON的格式放在请求体内") PayVo payVo) throws IllegalAccessException {
        return authService.getToken(payVo);
    }

}
